/*
 * @Description: In User Settings Edit
 * @Author: your name
 * @Date: 2018-09-11 23:26:20
 * @LastEditTime: 2021-11-22 19:03:08
 * @LastEditors: vai-bowei
 */
/**
 * 此文件管理项目所有接口
 */
import {get, post,transmitGet} from './network';

/**
 * 服务器根域名
 * 试玩更多接口看这里
 * http://jsonplaceholder.typicode.com/
 * @type {string}
 */

export const API_CampusRoot = 'https://campus.lancooedu.com';
// export const API_CampusRoot = 'http://192.168.129.203:7779';
// 校园通相关Api
/**
 * @description: 微信登录，每次进小程序先使用这个登录
 */
const wxLoginApi = (urlParams) => post(`${API_CampusRoot}/wxlogin`, urlParams);


// 校园通相关Api
/**
 * @description: 微信登录，UnionID自动登录
 */
const wxLoginWithUnionIDApi = (urlParams) => post(`${API_CampusRoot}/wxLogin`, urlParams);

/**
 * @description:  判断是否绑定微信
 * @param unionID
 * @return: 
 */
const wxUserHasBindApi = (urlParams) => post(`${API_CampusRoot}/wxuser/hasBind`, urlParams);

/**
 * @description: 云平台登入
 * @param {type} 
 * @return: 
 */
const yunLoginApi = (urlParams) => post(`${API_CampusRoot}/yunlogin`, urlParams);

/**
 * @description: 云平台登出
 * @param {type} 
 * @return: 
 */
const yunLogoutApi = (urlParams) => post(`${API_CampusRoot}/yunlogout`, urlParams);

//获取全部学校
const getSchoolApi = () => get(`${API_CampusRoot}/school/getAll`);

const getRightApi = () => get(`${API_CampusRoot}/right/getAll`);

//获取所有子系统信息(校园通)
const getAllSubsystemsApi = (urlParams) => get(`${API_CampusRoot}/school/getSubsystem`,urlParams);

//获取学校子系统URL 
const subsystemUrlApi = (url,urlParams) => transmitGet(`${url}/Base/WS/Service_Basic.asmx/WS_G_GetSubSystemServerInfoForAllSubject`, urlParams);
//获取学校学期信息
const schoolTermApi = (url,urlParams) => transmitGet(`${url}/SysMgr/SysSetting/Api/Service_SysSetting.ashx`, urlParams);

//获取所有子系统信息
const getUnionIdApi = (urlParams) => post(`${API_CampusRoot}/wxUser/getUnionId`,urlParams);

const  testApi = (url= 'http://trainsc.lancooecp.com:10804/api/v1/Common/time',urlParams = null,header ={'Content-Type':'application/json','Lg_MgrCenter_Token':'B','Lg_MgrCenter_UserId':'s034','Lg_MgrCenter_Client':0}) => transmitGet(url,urlParams,header);

export default {
    subsystemUrlApi,
    schoolTermApi,
    getAllSubsystemsApi,
    getRightApi,
    getSchoolApi,
    yunLogoutApi,
    yunLoginApi,
    wxUserHasBindApi,
    wxLoginApi,
    getUnionIdApi,
    testApi,
    wxLoginWithUnionIDApi,
}

